package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.DmsPullTeaDataDictService;
import com.yunhai.model.entity.dms.DmsPullTeaDataDictEntity;
import com.yunhai.model.vo.dms.DmsPullTeaDataDictQuery;
import com.yunhai.model.vo.dms.DmsPullTeaDataDictVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pullTeaDataDict")
public class DmsPullTeaDataDictController {

    @Resource
    private DmsPullTeaDataDictService dmsPullTeaDataDictService;


    /**
     * 获取 DmsPullTeaDataDict 分页列表
     */
    @GetMapping("/pagination")
    public Ret getDmsPullTeaDataDictPagination(PaginationVo paginationVo, DmsPullTeaDataDictQuery dmsPullTeaDataDictQuery ) throws Exception {
        IPage page = dmsPullTeaDataDictService.getDmsPullTeaDataDictPagination(paginationVo, dmsPullTeaDataDictQuery );
        return Ret.toPage(page);
    }


    /**
     * 获取 DmsPullTeaDataDict 所有数据
     */
    @GetMapping("/all")
    public Ret getDmsPullTeaDataDictAllList( DmsPullTeaDataDictQuery dmsPullTeaDataDictQuery ) throws Exception {
        List<DmsPullTeaDataDictEntity> list = dmsPullTeaDataDictService.getDmsPullTeaDataDictAllList( dmsPullTeaDataDictQuery );
        return Ret.ok(list);
    }



    /**
     * 获取 DmsPullTeaDataDict 详情
    */
   @GetMapping("/{id}")
   public Ret getDmsPullTeaDataDictDetail(@PathVariable Long id) throws Exception {

       DmsPullTeaDataDictEntity dmsPullTeaDataDict = dmsPullTeaDataDictService.getDmsPullTeaDataDictDetail(id);
       return Ret.ok(dmsPullTeaDataDict);
   }


    /**
     * 新增 DmsPullTeaDataDict
     * */
    @PostMapping("")
    public Ret addDmsPullTeaDataDict(@RequestBody DmsPullTeaDataDictVo dmsPullTeaDataDictVo) throws Exception {

        dmsPullTeaDataDictService.addDmsPullTeaDataDict(dmsPullTeaDataDictVo);
        return Ret.ok();
    }


    /**
     * 更新 DmsPullTeaDataDict
     * */
    @PutMapping("")
    public Ret updateDmsPullTeaDataDict(@RequestBody DmsPullTeaDataDictVo dmsPullTeaDataDictVo) throws Exception {

        dmsPullTeaDataDictService.updateDmsPullTeaDataDict(dmsPullTeaDataDictVo);
        return Ret.ok();
    }


    /**
     * 删除 DmsPullTeaDataDict
     * */
    @PostMapping("/batchRemove")
    public Ret batchRemoveDmsPullTeaDataDict( @RequestBody List<Long> ids ) throws Exception {

        dmsPullTeaDataDictService.batchRemoveDmsPullTeaDataDict(ids);
        return Ret.ok();
    }
}

  